"""散点图"""
import numpy as np
import matplotlib.pyplot as plt

plt.rcParams['font.family'] = ['SimHei']  # 用来显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号
fig, ax = plt.subplots()
x1 = np.arange(1, 30)
y1 = np.sin(x1)

ax1 = plt.subplot(1, 1, 1)
plt.title('散点图')
plt.xlabel('X')
plt.ylabel('Y')
lvalue = x1
ax1.scatter(x1, y1, c='r', s=100, linewidths=lvalue, marker='o')
plt.legend('x1')
plt.show()
# 保存图片,transparent=True指定图片透明度,pad_inches=0去除所有白边
fig.savefig("pic/ex8.png", format='png', transparent=True, dpi=300, pad_inches=0)
